Skip to content

Conversation

@nakamura2000
Copy link
Contributor

if parameters have only content-type and don't have name parameter and filename parameter, ParseParameterPart throws key not found Exception. ( parameters["name"] ). Use ParseFilePart in this case.

if parameters don't have name parameter and filename parameter, ParseParameterPart throws key not found Exception. ( parameters["name"] )
@Jericho Jericho changed the title improve parameter handling Fix "Key not found" exception when name and filename parameters are omitted Apr 30, 2020
@Jericho
Copy link
Collaborator

Jericho commented Apr 30, 2020

At first I was skeptical about your suggestion to treat a parameter without name as a file. I was concerned that it could potentially change how we treat some parameters but I realized that the name is indeed required to uniquely identify "data" parameters and therefore a parameter without name cannot be a "data" parameter. Currently, as you reported, we throw an exception when a parameter is missing the name which means that the parsing of the form data completely fails.

Your PR allows the parsing to be successful even if a parameter does not have a name in addition to supporting the mjpeg stream scenario you mentioned in the issue you raised.

Overall, I think this is a great improvement so I will merge your PR, add a few unit tests and release an update shortly.

Thank you for your contribution!

@Jericho Jericho merged commit d4a8507 into Http-Multipart-Data-Parser:develop Apr 30, 2020
@nakamura2000 nakamura2000 deleted the feature/support_mixed branch May 1, 2020 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants